← all projects
Shared pre-push hook with npm lint and repository hook support
Shared pre-push hook with npm lint and repository hook support
Shared pre-push hook
This global Git hook:
- runs
npm run lintwhen a repository defines an npmlintscript; - runs
composer lint:pre-pushwhen available, otherwisecomposer lint; - calls an executable
.repo-hooks.shfrom the repository root; - falls back to the older
repo-hooks.shfilename.
Install
Save pre-push to your global Git hooks directory, then run:
chmod +x ~/.config/git/hooks/pre-push
git config --global core.hooksPath ~/.config/git/hooks
Composer repositories can define lint:pre-push when linting needs access to
Git's pre-push ref data. Repositories can also provide other pre-push behavior
in an executable .repo-hooks.sh file.